#import "Server.h"

#include "tcp4.h"
#include "socket.h"

struct ServerImpl {
    TCP4* socket;
};

struct SocketImpl {
    
    Socket* socket;
    
};

@implementation Server

- (id)init
{
    self = [super init];
    if (self)
    {
        impl = new ServerImpl;
        Socket = new SocketImpl;
    }
    
    impl->socket = new TCP4();
    
    impl->socket->Bind(2001);
    
    impl->socket->Listen();
    
    Socket->socket = impl->socket->Accept();
    
    char Buffer[1000] = "Test";
    
    Socket->socket->Send(Buffer, 1000);
    
    Socket->socket->Close();
    
    
    return self;
}
- (void)dealloc
{
    delete impl;
}


@end